*** 1.9	1992/11/07 04:57:45
--- c-decl.c	1992/11/08 00:48:24
***************
*** 5868,5873 ****
--- 5868,5875 ----
  
    expand_function_start (fndecl, 0);
  
+ #if (!(defined(atarist) || defined(CROSSATARI) || defined(atariminix)))
+   /* we will only need this in cp-decl.c, not here */
    /* If this function is `main', emit a call to `__main'
       to run global initializers, etc.  */
    if (DECL_NAME (fndecl)
***************
*** 5874,5879 ****
--- 5876,5882 ----
        && strcmp (IDENTIFIER_POINTER (DECL_NAME (fndecl)), "main") == 0
        && DECL_CONTEXT (fndecl) == NULL_TREE)
      expand_main_function ();
+ #endif
  }
  
  /* SPECPARMS is an identifier list--a chain of TREE_LIST nodes
*** 1.5	1992/11/07 04:57:45
--- c-lex.c	1992/11/08 00:48:25
***************
*** 391,396 ****
--- 391,397 ----
  	case '\r':
  	  /* ANSI C says the effects of a carriage return in a source file
  	     are undefined.  */
+ #ifndef atarist /* but not on an atarist, though hopefully we should'nt see it */
  	  if (pedantic && !newline_warning)
  	    {
  	      warning ("carriage return in source file");
***************
*** 397,402 ****
--- 398,404 ----
  	      warning ("(we only warn about the first carriage return)");
  	      newline_warning = 1;
  	    }
+ #endif
  	  c = getc (finput);
  	  break;
  
*** 1.11	1992/11/07 04:57:45
--- cccp.c	1992/11/08 00:48:31
***************
*** 71,76 ****
--- 71,78 ----
  #undef bzero
  #undef bcmp
  
+ #ifndef atarist
+ 
  #include <sys/types.h>
  #include <sys/stat.h>
  #include <ctype.h>
***************
*** 77,91 ****
  #include <stdio.h>
  
  #ifndef VMS
! #ifndef USG
  #include <sys/time.h>		/* for __DATE__ and __TIME__ */
  #include <sys/resource.h>
  #else
  #include <time.h>
  #include <fcntl.h>
! #endif /* USG */
  #endif /* not VMS */
  
  /* VMS-specific definitions */
  #ifdef VMS
  #include <time.h>
--- 79,111 ----
  #include <stdio.h>
  
  #ifndef VMS
! #if (!(defined(USG) || defined(atariminix)))
  #include <sys/time.h>		/* for __DATE__ and __TIME__ */
  #include <sys/resource.h>
  #else
  #include <time.h>
  #include <fcntl.h>
! #endif /* USG or atariminix */
  #endif /* not VMS */
  
+ #else	/* atarist */
+ 
+ #include <ctype.h>
+ #include <stdio.h>
+ #include <types.h>
+ #include <stat.h>
+ #include <file.h>
+ #include <time.h>
+ #include <string.h>
+ #include "stddef.h"
+ 
+ long _stksize = -1L;	/* want big stack cause include files
+ 				   get alloca'ed there */
+ 
+ #define read(fd,buf,size)	_text_read(fd,buf,size)
+ 
+ #endif		/* atarist */
+ 
  /* VMS-specific definitions */
  #ifdef VMS
  #include <time.h>
***************
*** 925,930 ****
--- 945,971 ----
  /* Nonzero means -I- has been seen,
     so don't look for #include "foo" the source-file directory.  */
  static int ignore_srcdir;
+  
+ #ifdef atarist
+ /* the following dingus is used in place of some calls to bcopy,
+    to ensure that backslashes get properly slashified when getting
+    shoved into strings.  Note that it returns the new pointer!!
+    There ought to be a better way... */
+ 
+ U_CHAR * slashifying_bcopy(from_buf, to_buf, nbytes)
+ U_CHAR * from_buf, * to_buf;
+ int nbytes;
+ {
+   for ( ; nbytes > 0 ; )
+ 	{
+ 	if(*from_buf == '\\')
+ 		*to_buf++ = '\\';
+ 	*to_buf++ = *from_buf++;
+ 	nbytes--;
+ 	}
+   return(to_buf);
+ }
+ #endif		/* atarist */
  
  int
  main (argc, argv)
***************
*** 963,968 ****
--- 1004,1014 ----
    /* Target-name to write with the dependency information.  */
    char *deps_target = 0;
  
+ #ifdef atarist
+ /* turn this on if you are going to set the TOS 1.4 dont clear heap flag */
+ /*  _malloczero(1); */ 	/* zero mallocs by default */
+ #endif  
+ 
  #ifdef RLIMIT_STACK
    /* Get rid of any avoidable limit on stack size.  */
    {
***************
*** 1210,1219 ****
--- 1256,1271 ----
  	break;
  
        case 'v':
+ #if (defined(atarist) || defined(CROSSATARI) || defined(atariminix))
+ #include "PatchLev.h"
+ 	fprintf (stderr, "GNU CPP-atariST version %s Patchlevel %s",
+ 		 version_string, PatchLevel);
+ #else
  	fprintf (stderr, "GNU CPP version %s", version_string);
  #ifdef TARGET_VERSION
  	TARGET_VERSION;
  #endif
+ #endif
  	fprintf (stderr, "\n");
  	break;
  
***************
*** 1345,1350 ****
--- 1397,1403 ----
      }
    }
  
+ #if (!(defined(atarist) || defined(CROSSATARI) || defined(atariminix)))
    /* Add dirs from CPATH after dirs from -I.  */
    /* There seems to be confusion about what CPATH should do,
       so for the moment it is not documented.  */
***************
*** 1354,1359 ****
--- 1407,1413 ----
    p = (char *) getenv ("CPATH");
    if (p != 0 && ! no_standard_includes)
      path_include (p);
+ #endif
  
    /* Now that dollars_in_ident is known, initialize is_idchar.  */
    initialize_char_syntax ();
***************
*** 1477,1484 ****
    { /* read the appropriate environment variable and if it exists
         replace include_defaults with the listed path. */
      char *epath = 0;
      switch ((objc << 1) + cplusplus)
!       {
        case 0:
  	epath = getenv ("C_INCLUDE_PATH");
  	break;
--- 1531,1586 ----
    { /* read the appropriate environment variable and if it exists
         replace include_defaults with the listed path. */
      char *epath = 0;
+ #if (defined(atarist) || defined(CROSSATARI) || defined(atariminix))
+     int db_hack = 0;
+     char *e1 = getenv("GNUINC"), *e2 = getenv("GNULIB"),
+          *e3 = getenv("GXXINC");
+ 
+ 
+     /* Get length of the alloc'ed array. (Yeah I know, I might alloc
+      * a character more than I need but who cares...
+      */
+     if (cplusplus && e3)
+ 	db_hack += strlen (e3);
+     if (e1)
+ 	    db_hack += strlen (e1) + 1;
+     if (e2)
+ 	    db_hack += strlen (e1) + 1;
+ 
+     if (db_hack) {
+ 	epath = alloca (db_hack + 1);
+ 	*epath = '\0';
+ 	db_hack = 0;
+ 
+ 	/* Concatenate the paths together. */
+ 	if (cplusplus && e3) {
+ 	    strcpy (epath, e3);
+ 	    db_hack = 1;
+ 	}
+ 	if (e1) {
+ 	    if (db_hack) {
+ 		strcat (epath, PATH_SEP_STR);
+ 	    }
+ 	    strcat (epath, e1);
+ 	    db_hack = 1;
+ 	}
+ 	if (e2) {
+ 	    if (db_hack) {
+ 		strcat (epath, PATH_SEP_STR);
+ 	    }
+ 	    strcat (epath, e2);
+ 	}
+     }
+ 
+ #ifdef atarist
+     if (epath)
+     	for (e3=epath; *e3; e3++)	/* Use one kind of path separator */
+ 	    if (*e3 == ';')
+ 		*e3 = PATH_SEPARATOR;
+ #endif
+ #else
      switch ((objc << 1) + cplusplus)
!     {
        case 0:
  	epath = getenv ("C_INCLUDE_PATH");
  	break;
***************
*** 1491,1497 ****
        case 3:
  	epath = getenv ("OBJCPLUS_INCLUDE_PATH");
  	break;
!       }
      /* If the environment var for this language is set,
         add to the default list of include directories.  */
      if (epath) {
--- 1593,1601 ----
        case 3:
  	epath = getenv ("OBJCPLUS_INCLUDE_PATH");
  	break;
!     }
! #endif
! 
      /* If the environment var for this language is set,
         add to the default list of include directories.  */
      if (epath) {
***************
*** 1545,1551 ****
--- 1649,1659 ----
    if (!no_standard_includes) {
      struct default_include *p = include_defaults;
      char *specd_prefix = include_prefix;
+ #ifdef GCC_INCLUDE_DIR
      char *default_prefix = savestring (GCC_INCLUDE_DIR);
+ #else
+     char *default_prefix = savestring ("./");
+ #endif
      int default_len = 0;
      /* Remove the `include' from /usr/local/lib/gcc.../include.  */
      if (!strcmp (default_prefix + strlen (default_prefix) - 8, "/include")) {
***************
*** 1552,1557 ****
--- 1660,1671 ----
        default_len = strlen (default_prefix) - 7;
        default_prefix[default_len] = 0;
      }
+ #ifdef atarist
+     else if (!strcmp (default_prefix + strlen (default_prefix) - 8, "\\include")) {
+       default_len = strlen (default_prefix) - 7;
+       default_prefix[default_len] = 0;
+     }
+ #endif
      /* Search "translated" versions of GNU directories.
         These have /usr/local/lib/gcc... replaced by specd_prefix.  */
      if (specd_prefix != 0 && default_len != 0)
***************
*** 1678,1684 ****
--- 1792,1802 ----
        char *p1 = p;
        /* Discard all directory prefixes from P.  */
        while (*p1) {
+ #ifdef atarist
+ 	if ((*p1 == '/') || (*p1 == '\\'))
+ #else
  	if (*p1 == '/')
+ #endif
  	  p = p1 + 1;
  	p1++;
        }
***************
*** 1840,1845 ****
--- 1958,1964 ----
    return 0;
  }
  
+ #if (!(defined(atarist) || defined(CROSSATARI) || defined(atariminix)))
  /* Given a colon-separated list of file names PATH,
     add all the names to the search path for include files.  */
  
***************
*** 1886,1891 ****
--- 2005,2011 ----
        p++;
      }
  }
+ #endif /* atarist */
  
  /* Pre-C-Preprocessor to translate ANSI trigraph idiocy in BUF
     before main CCCP processing.  Name `pcp' is also in honor of the
***************
*** 3040,3045 ****
--- 3160,3166 ----
    assertions_flag = save_assertions_flag;
    return obuf;
  }
+ /* #endif */
  
  /*
   * Process a # directive.  Expects IP->bufp to point after the '#', as in
***************
*** 3501,3508 ****
--- 3622,3638 ----
  
        if (string)
  	{
+ #ifndef atarist
  	  buf = (char *) alloca (3 + strlen (string));
  	  sprintf (buf, "\"%s\"", string);
+ #else
+     	  buf = (char *) alloca (16 + strlen (string));
+           {
+ 	      char *tbuf = (char *) alloca (16 + strlen (string));
+ 	      (void) slashifying_bcopy(string, tbuf, strlen(string)+1);
+ 	      sprintf (buf, "\"%s\"", tbuf);
+           }
+ #endif /* atarist */
  	}
        else
  	buf = "\"\"";
***************
*** 3724,3730 ****
--- 3854,3865 ----
  	    dsp[0].next = search_start;
  	    search_start = dsp;
  #ifndef VMS
+ #ifdef atarist
+ 	    if((ep = rindex(nam, '\\')) == NULL)
+ 		ep = rindex(nam, '/');
+ #else
  	    ep = rindex (nam, '/');
+ #endif
  #else				/* VMS */
  	    ep = rindex (nam, ']');
  	    if (ep == NULL) ep = rindex (nam, '>');
***************
*** 3800,3808 ****
--- 3935,3957 ----
  
    /* If specified file name is absolute, just open it.  */
  
+ #ifdef atarist
+   if ((*fbeg == '\\') || (*fbeg == '/')) {
+     if(fbeg[2] == ':')
+     { /* allow "\D:\xxx" */
+         strncpy (fname, fbeg+1, flen-1);
+         fname[flen-1] = 0;
+     }
+     else
+     {  /* allow "\lib\xxx" == "\currentdrive:\lib\xxx" */
+         strncpy (fname, fbeg, flen);
+         fname[flen] = 0;
+     }
+ #else
    if (*fbeg == '/') {
      strncpy (fname, fbeg, flen);
      fname[flen] = 0;
+ #endif
      if (redundant_include_p (fname))
        return 0;
      if (importing)
***************
*** 3823,3829 ****
--- 3972,3982 ----
  	if (searchptr->fname[0] == 0)
  	  continue;
  	strcpy (fname, searchptr->fname);
+ #ifdef atarist
+ 	strcat (fname, "\\");
+ #else
  	strcat (fname, "/");
+ #endif
  	fname[strlen (fname) + flen] = 0;
        } else {
  	fname[0] = 0;
***************
*** 3945,3961 ****
  
      if (!no_precomp)
        do {
  	sprintf (pcftry, "%s%d", fname, pcfnum++);
  	
  	pcf = open (pcftry, O_RDONLY, 0666);
  	if (pcf != -1)
  	  {
  	    struct stat s;
  
  	    fstat (pcf, &s);
  	    if (bcmp (&stat_f.st_ino, &s.st_ino, sizeof (s.st_ino))
  		|| stat_f.st_dev != s.st_dev)
! 	      {
  		pcfbuf = check_precompiled (pcf, fname, &pcfbuflimit);
  		/* Don't need it any more.  */
  		close (pcf);
--- 4098,4156 ----
  
      if (!no_precomp)
        do {
+ #ifdef atarist
+ 	int numlen;
+ 	char *dot;
+ 	char *slash;
+ 
+ 	/* cut extension to 3 chars and dont depend on UNIXMODE           */
+ 	/* this will have to be done when saving precompiled headers, too */
+ 	/* but as far as I tried, they dont work up to now, anyway   (AL) */
+ 
+ 	  if( pcfnum>=100 )     numlen=3;
+ 	  else if( pcfnum>=10 ) numlen=2;
+ 	  else                  numlen=1;
+ 
+ 	  dot=strrchr( fname, '.' );
+ 	  if( (slash=strrchr( fname, '/')) && slash>dot )
+ 	    dot=NULL;
+ 	  else
+ 	  if( (slash=strrchr( fname, '\\')) && slash>dot )
+ 	    dot=NULL;
+ 
+ 	  if( dot ) {
+ 	    if( strlen(dot)-1>3-numlen ) {
+ 	      sprintf(pcftry, "%.*s%d", strlen(fname)-(strlen(dot)-(4-numlen)),
+ 	      		fname, pcfnum++);
+ 	    } else {
+ 	      sprintf(pcftry, "%s%d", fname, pcfnum++);
+ 	    }
+ 	  } else {
+ 	    sprintf( pcftry, "%s.%d", fname, pcfnum++);
+ 	  }
+ #else	/* looks like we got a sane filesystem */
  	sprintf (pcftry, "%s%d", fname, pcfnum++);
+ #endif
+ #if 0
+ 	fprintf ( stderr, "trying precompiled file %s.\n", pcftry );
+ #endif
  	
  	pcf = open (pcftry, O_RDONLY, 0666);
  	if (pcf != -1)
  	  {
+ #ifndef atarist
+ 	    /* dont bother with this on the ST since these field are faked
+ 	     * anyways
+              */
  	    struct stat s;
  
  	    fstat (pcf, &s);
  	    if (bcmp (&stat_f.st_ino, &s.st_ino, sizeof (s.st_ino))
  		|| stat_f.st_dev != s.st_dev)
! #else
! 	    if (1)
! #endif
!               {
  		pcfbuf = check_precompiled (pcf, fname, &pcfbuflimit);
  		/* Don't need it any more.  */
  		close (pcf);
***************
*** 6831,6838 ****
--- 7026,7037 ----
    check_expand (op, len + 1);
    if (op->bufp > op->buf && op->bufp[-1] != '\n')
      *op->bufp++ = '\n';
+ #ifdef atarist
+   op->bufp = slashifying_bcopy (line_cmd_buf, op->bufp, len);
+ #else
    bcopy (line_cmd_buf, op->bufp, len);
    op->bufp += len;
+ #endif
    op->lineno = ip->lineno;
  }
  
***************
*** 8476,8481 ****
--- 8675,8681 ----
    deps_buffer[deps_size] = 0;
  }
  
+ #if (!(defined(atarist) || defined(atariminix)))
  #if defined(USG) || defined(VMS)
  #ifndef BSTRING
  
***************
*** 8512,8518 ****
  }
  #endif /* not BSTRING */
  #endif /* USG or VMS */
! 
  
  static void
  fatal (str, arg)
--- 8712,8718 ----
  }
  #endif /* not BSTRING */
  #endif /* USG or VMS */
! #endif /* any atari */
  
  static void
  fatal (str, arg)
*** 1.8	1992/11/07 04:57:45
--- cp-tree.c	1992/11/08 00:48:47
***************
*** 1692,1697 ****
--- 1692,1698 ----
    print_class_statistics ();
  }
  
+ #ifndef atarist
  /* This is used by the `assert' macro.  It is provided in libgcc.a,
     which `cc' doesn't know how to link.  */
  void
***************
*** 1712,1717 ****
--- 1713,1719 ----
    fflush (stderr);
    abort ();
  }
+ #endif
  
  /* Return, as an INTEGER_CST node, the number of elements for
     TYPE (which is an ARRAY_TYPE).  This counts only elements of the top array. */
*** 1.5	1992/11/07 04:57:45
--- expr.c	1992/11/08 00:49:01
***************
*** 1960,1965 ****
--- 1960,1971 ----
  
    argvec = (struct arg *) alloca (nargs * sizeof (struct arg));
  
+ /* how would you do this RIGHT ?? fake a DECL node? dunno... */
+ #ifdef ENCODE_SECTION_INFO
+   /* mark it as a function (to be in the text section that is) */
+   SYMBOL_REF_FLAG (fun) = 1;
+ #endif
+ 
    INIT_CUMULATIVE_ARGS (args_so_far, (tree)0, fun);
  
    args_size.constant = 0;
*** 1.10	1992/11/07 04:57:45
--- final.c	1992/11/08 00:49:02
***************
*** 67,74 ****
--- 67,78 ----
  #if defined (USG) || defined (NO_STAB_H)
  #include "gstab.h"  /* If doing DBX on sysV, use our own stab.h.  */
  #else
+ #if defined(CROSSATARI) || defined(atarist) || defined(atariminix)
+ #include "astab.h"
+ #else
  #include <stab.h>  /* On BSD, use the system's stab.h.  */
  #endif /* not USG */
+ #endif /* not atari */
  #endif /* DBX_DEBUGGING_INFO || XCOFF_DEBUGGING_INFO */
  
  #ifdef XCOFF_DEBUGGING_INFO
*** 1.15	1992/11/07 04:57:45
--- gcc.c	1992/11/08 00:49:08
***************
*** 30,35 ****
--- 30,44 ----
  Once it knows which kind of compilation to perform, the procedure for
  compilation is specified by a string called a "spec".  */
  
+ #ifdef CROSSATARI
+ #ifdef atarist
+ #undef atarist
+ #endif
+ #ifdef atariminix
+ #undef atariminix
+ #endif
+ #endif
+   
  #include <sys/types.h>
  #include <ctype.h>
  #include <signal.h>
***************
*** 40,45 ****
--- 49,57 ----
  #include "obstack.h"
  #include "gvarargs.h"
  #include <stdio.h>
+ #ifdef CROSSATARI
+ #include <ctype.h>
+ #endif
  
  #ifndef R_OK
  #define R_OK 4
***************
*** 65,71 ****
  #define NULL_PTR ((GENERIC_PTR)0)
  #endif
  
! #ifdef USG
  #define vfork fork
  #endif /* USG */
  
--- 77,83 ----
  #define NULL_PTR ((GENERIC_PTR)0)
  #endif
  
! #if (defined(USG) || defined(atariminix))
  #define vfork fork
  #endif /* USG */
  
***************
*** 97,102 ****
--- 109,121 ----
  #define PATH_SEPARATOR ':'
  #endif
  
+ #ifdef atarist
+ #include <osbind.h>
+ #include <ctype.h>
+ #include <fcntl.h>		/* fgth, for redirection of stderr */
+ long _stksize = 8192;
+ #endif
+ 
  #define obstack_chunk_alloc xmalloc
  #define obstack_chunk_free free
  
***************
*** 153,159 ****
--- 172,180 ----
     pass the compiler in building the list of pointers to constructors
     and destructors.  */
  
+ #if (!(defined(CROSSATARI) || defined(atarist)))
  static struct obstack collect_obstack;
+ #endif
  
  extern char *version_string;
  
***************
*** 445,451 ****
  		   %{aux-info*}\
  		   %{pg:%{fomit-frame-pointer:%e-pg and -fomit-frame-pointer are incompatible}}\
  		   %{S:%W{o*}%{!o*:-o %b.s}}%{!S:-o %{|!pipe:%g.s}} |\n\
!               %{!S:as %{R} %{j} %{J} %{h} %{d2} %a %Y\
  		      %{c:%W{o*}%{!o*:-o %w%b.o}}%{!c:-o %d%w%u.o}\
                        %{!pipe:%g.s} %A\n }}}}"},
    {"-",
--- 466,472 ----
  		   %{aux-info*}\
  		   %{pg:%{fomit-frame-pointer:%e-pg and -fomit-frame-pointer are incompatible}}\
  		   %{S:%W{o*}%{!o*:-o %b.s}}%{!S:-o %{|!pipe:%g.s}} |\n\
!               %{!S:as %{v} %{R} %{j} %{J} %{h} %{d2} %a %Y\
  		      %{c:%W{o*}%{!o*:-o %w%b.o}}%{!c:-o %d%w%u.o}\
                        %{!pipe:%g.s} %A\n }}}}"},
    {"-",
***************
*** 478,484 ****
  		   %{aux-info*}\
  		   %{pg:%{fomit-frame-pointer:%e-pg and -fomit-frame-pointer are incompatible}}\
  		   %{S:%W{o*}%{!o*:-o %b.s}}%{!S:-o %{|!pipe:%g.s}} |\n\
!               %{!S:as %{R} %{j} %{J} %{h} %{d2} %a %Y\
  		      %{c:%W{o*}%{!o*:-o %w%b.o}}%{!c:-o %d%w%u.o}\
                        %{!pipe:%g.s} %A\n }}}}"},
    {".h", "@c-header"},
--- 499,505 ----
  		   %{aux-info*}\
  		   %{pg:%{fomit-frame-pointer:%e-pg and -fomit-frame-pointer are incompatible}}\
  		   %{S:%W{o*}%{!o*:-o %b.s}}%{!S:-o %{|!pipe:%g.s}} |\n\
!               %{!S:as %{v} %{R} %{j} %{J} %{h} %{d2} %a %Y\
  		      %{c:%W{o*}%{!o*:-o %w%b.o}}%{!c:-o %d%w%u.o}\
                        %{!pipe:%g.s} %A\n }}}}"},
    {".h", "@c-header"},
***************
*** 513,519 ****
  		   %{aux-info*}\
  		   %{pg:%{fomit-frame-pointer:%e-pg and -fomit-frame-pointer are incompatible}}\
  		   %{S:%W{o*}%{!o*:-o %b.s}}%{!S:-o %{|!pipe:%g.s}} |\n\
!               %{!S:as %{R} %{j} %{J} %{h} %{d2} %a %Y\
  		      %{c:%W{o*}%{!o*:-o %w%b.o}}%{!c:-o %d%w%u.o}\
                        %{!pipe:%g.s} %A\n }}}}"},
    {".i", "@cpp-output"},
--- 534,540 ----
  		   %{aux-info*}\
  		   %{pg:%{fomit-frame-pointer:%e-pg and -fomit-frame-pointer are incompatible}}\
  		   %{S:%W{o*}%{!o*:-o %b.s}}%{!S:-o %{|!pipe:%g.s}} |\n\
!               %{!S:as %{v} %{R} %{j} %{J} %{h} %{d2} %a %Y\
  		      %{c:%W{o*}%{!o*:-o %w%b.o}}%{!c:-o %d%w%u.o}\
                        %{!pipe:%g.s} %A\n }}}}"},
    {".i", "@cpp-output"},
***************
*** 524,530 ****
  	%{aux-info*}\
  	%{pg:%{fomit-frame-pointer:%e-pg and -fomit-frame-pointer are incompatible}}\
  	%{S:%W{o*}%{!o*:-o %b.s}}%{!S:-o %{|!pipe:%g.s}} |\n\
!     %{!S:as %{R} %{j} %{J} %{h} %{d2} %a %Y\
              %{c:%W{o*}%{!o*:-o %w%b.o}}%{!c:-o %d%w%u.o} %{!pipe:%g.s} %A\n }"},
    {".ii", "@c++-cpp-output"},
    {"@c++-cpp-output",
--- 545,551 ----
  	%{aux-info*}\
  	%{pg:%{fomit-frame-pointer:%e-pg and -fomit-frame-pointer are incompatible}}\
  	%{S:%W{o*}%{!o*:-o %b.s}}%{!S:-o %{|!pipe:%g.s}} |\n\
!     %{!S:as %{v} %{R} %{j} %{J} %{h} %{d2} %a %Y\
              %{c:%W{o*}%{!o*:-o %w%b.o}}%{!c:-o %d%w%u.o} %{!pipe:%g.s} %A\n }"},
    {".ii", "@c++-cpp-output"},
    {"@c++-cpp-output",
***************
*** 534,547 ****
  	    %{aux-info*}\
  	    %{pg:%{fomit-frame-pointer:%e-pg and -fomit-frame-pointer are incompatible}}\
  	    %{S:%W{o*}%{!o*:-o %b.s}}%{!S:-o %{|!pipe:%g.s}} |\n\
!        %{!S:as %{R} %{j} %{J} %{h} %{d2} %a %Y\
  	       %{c:%W{o*}%{!o*:-o %w%b.o}}%{!c:-o %d%w%u.o}\
  	       %{!pipe:%g.s} %A\n }"},
    {".s", "@assembler"},
    {"@assembler",
!    "%{!S:as %{R} %{j} %{J} %{h} %{d2} %a %Y\
              %{c:%W{o*}%{!o*:-o %w%b.o}}%{!c:-o %d%w%u.o} %i %A\n }"},
    {".S", "@assembler-with-cpp"},
    {"@assembler-with-cpp",
     "cpp -lang-asm %{nostdinc*} %{C} %{v} %{A*} %{D*} %{U*} %{I*} %{i*} %{P} %I\
  	%{C:%{!E:%eGNU C does not support -C without using -E}}\
--- 555,571 ----
  	    %{aux-info*}\
  	    %{pg:%{fomit-frame-pointer:%e-pg and -fomit-frame-pointer are incompatible}}\
  	    %{S:%W{o*}%{!o*:-o %b.s}}%{!S:-o %{|!pipe:%g.s}} |\n\
!        %{!S:as %{v} %{R} %{j} %{J} %{h} %{d2} %a %Y\
  	       %{c:%W{o*}%{!o*:-o %w%b.o}}%{!c:-o %d%w%u.o}\
  	       %{!pipe:%g.s} %A\n }"},
    {".s", "@assembler"},
    {"@assembler",
!    "%{!S:as %{v} %{R} %{j} %{J} %{h} %{d2} %a %Y\
              %{c:%W{o*}%{!o*:-o %w%b.o}}%{!c:-o %d%w%u.o} %i %A\n }"},
    {".S", "@assembler-with-cpp"},
+   {".ss", "@assembler-with-cpp"},
+   {".cpp", "@assembler-with-cpp"},
+   {".spp", "@assembler-with-cpp"},
    {"@assembler-with-cpp",
     "cpp -lang-asm %{nostdinc*} %{C} %{v} %{A*} %{D*} %{U*} %{I*} %{i*} %{P} %I\
  	%{C:%{!E:%eGNU C does not support -C without using -E}}\
***************
*** 551,557 ****
          %{traditional-cpp:-traditional}\
  	%{g*} %{W*} %{w} %{pedantic*} %{H} %{d*} %C\
          %i %{!M:%{!MM:%{!E:%{!pipe:%g.s}}}}%{E:%W{o*}}%{M:%W{o*}}%{MM:%W{o*}} |\n",
!    "%{!M:%{!MM:%{!E:%{!S:as %{R} %{j} %{J} %{h} %{d2} %a %Y\
                      %{c:%W{o*}%{!o*:-o %w%b.o}}%{!c:-o %d%w%u.o}\
  		    %{!pipe:%g.s} %A\n }}}}"},
    /* Mark end of table */
--- 575,581 ----
          %{traditional-cpp:-traditional}\
  	%{g*} %{W*} %{w} %{pedantic*} %{H} %{d*} %C\
          %i %{!M:%{!MM:%{!E:%{!pipe:%g.s}}}}%{E:%W{o*}}%{M:%W{o*}}%{MM:%W{o*}} |\n",
!    "%{!M:%{!MM:%{!E:%{!S:as %{v} %{R} %{j} %{J} %{h} %{d2} %a %Y\
                      %{c:%W{o*}%{!o*:-o %w%b.o}}%{!c:-o %d%w%u.o}\
  		    %{!pipe:%g.s} %A\n }}}}"},
    /* Mark end of table */
***************
*** 565,570 ****
--- 589,603 ----
  
  /* Here is the spec for running the linker, after compiling all files.  */
  
+ #if (defined(CROSSATARI) || defined(atarist) || defined(atariminix))
+ static char *link_command_spec = 
+  "%{!c:%{!M*:%{!E:%{!S:ld %X %{v} %{G} %{o*} %l\
+  %{A} %{d} %{e*} %{N} %{n} %{r} %{s} %{S} %{T*} %{t} %{u*} %{X} %{x} %{z}\
+  %{y*} %{!nostdlib:%S} \
+  %{L*} %o %{!nostdlib:%s %L}\n }}}}";
+ 
+ #else
+ 
  #ifdef LINK_LIBGCC_SPECIAL
  /* Have gcc do the search for libgcc.a.  */
  /* -u* was put back because both BSD and SysV seem to support it.  */
***************
*** 583,588 ****
--- 616,622 ----
  			%{!A:%{!nostdlib:%S}} %{static:}\
  			%{L*} %D %o %{!nostdlib:-lgcc %L -lgcc %{!A:%E}}\n }}}}}";
  #endif
+ #endif
  
  /* A vector of options to give to the linker.
     These options are accumulated by -Xlinker and -Wl,
***************
*** 596,601 ****
--- 630,636 ----
  static int n_assembler_options;
  static char **assembler_options;
  
+ #if (!(defined(atarist) || defined(CROSSATARI) || defined(atariminix)))
  /* Read compilation specs from a file named FILENAME,
     replacing the default ones.
  
***************
*** 734,739 ****
--- 769,775 ----
  
    return p;
  }
+ #endif /* ataris */
  
  /* Structure to keep track of the specs that have been defined so far.  These
     are accessed using %(specname) or %[specname] in a compiler or link spec. */
***************
*** 838,843 ****
--- 874,886 ----
  /* Name with which this program was invoked.  */
  
  static char *programname;
+ 
+ #ifdef atarist
+ /* Flag indicating, that stderr should be redirected for the child
+    processes */
+ 
+ unsigned char zflag;
+ #endif
  
  /* Structures to keep track of prefixes to try when looking for files. */
  
***************
*** 1094,1102 ****
  static void
  choose_temp_base ()
  {
-   char *base = getenv ("TMPDIR");
    int len;
  
    if (base == (char *)0)
      {
  #ifdef P_tmpdir
--- 1137,1162 ----
  static void
  choose_temp_base ()
  {
    int len;
+ #if (!(defined(atarist) || defined(atariminix)))
+   char *base = getenv ("TMPDIR");
+ #else
+   char *base = getenv ("TEMP");
  
+   if(base == (char *)0)
+   {
+       base = getenv("TMPDIR");
+       if(base == (char *)0)
+       base = getenv("TMP");
+   }
+   if(base != (char *)0)
+   {
+       char *newbase = alloca(FILENAME_MAX);
+       dos2unx(base,newbase);
+       base = newbase;
+   }
+ #endif
+ 
    if (base == (char *)0)
      {
  #ifdef P_tmpdir
***************
*** 1115,1121 ****
    len = strlen (base);
    temp_filename = xmalloc (len + sizeof("/ccXXXXXX"));
    strcpy (temp_filename, base);
!   if (len > 0 && temp_filename[len-1] != '/')
      temp_filename[len++] = '/';
    strcpy (temp_filename + len, "ccXXXXXX");
  
--- 1175,1185 ----
    len = strlen (base);
    temp_filename = xmalloc (len + sizeof("/ccXXXXXX"));
    strcpy (temp_filename, base);
!   if (len > 0 && (temp_filename[len-1] != '/' 
! #ifdef atarist
! 		  || temp_filename[len-1] != '\\'
! #endif
!  		  ))
      temp_filename[len++] = '/';
    strcpy (temp_filename + len, "ccXXXXXX");
  
***************
*** 1132,1137 ****
--- 1196,1202 ----
     use come from an obstack, we don't have to worry about allocating
     space for them.  */
  
+ #if (!(defined(CROSSATARI) || defined(atarist)))
  #ifndef HAVE_PUTENV
  
  putenv (str)
***************
*** 1226,1231 ****
--- 1291,1297 ----
    obstack_grow (&collect_obstack, "\0", 1);
    putenv (obstack_finish (&collect_obstack));
  }
+ #endif /* ataris */
  
  
  /* Search for NAME using the prefix list PREFIXES.  MODE is passed to
***************
*** 1501,1506 ****
--- 1567,1573 ----
  
  #else /* not __MSDOS__ */
  
+ #ifndef atarist
  static int
  pexecute (search_flag, program, argv, not_last)
       int search_flag;
***************
*** 1589,1594 ****
--- 1656,1662 ----
      }
  }
  
+ #endif /* not atarist */
  #endif /* not __MSDOS__ */
  #else /* not OS2 */
  
***************
*** 1619,1634 ****
      {
        char *prog;		/* program name.  */
        char **argv;		/* vector of args.  */
        int pid;			/* pid of process for this command.  */
      };
  
    struct command *commands;	/* each command buffer with above info.  */
  
    /* Count # of piped commands.  */
    for (n_commands = 1, i = 0; i < argbuf_index; i++)
      if (strcmp (argbuf[i], "|") == 0)
        n_commands++;
! 
    /* Get storage for each command.  */
    commands
      = (struct command *) alloca (n_commands * sizeof (struct command));
--- 1687,1707 ----
      {
        char *prog;		/* program name.  */
        char **argv;		/* vector of args.  */
+ #ifndef atarist
        int pid;			/* pid of process for this command.  */
+ #endif
      };
  
    struct command *commands;	/* each command buffer with above info.  */
  
+ #ifndef atarist
    /* Count # of piped commands.  */
    for (n_commands = 1, i = 0; i < argbuf_index; i++)
      if (strcmp (argbuf[i], "|") == 0)
        n_commands++;
! #else
!   n_commands = 1;
! #endif
    /* Get storage for each command.  */
    commands
      = (struct command *) alloca (n_commands * sizeof (struct command));
***************
*** 1643,1648 ****
--- 1716,1722 ----
    if (string)
      commands[0].argv[0] = string;
  
+ #ifndef atarist
    for (n_commands = 1, i = 0; i < argbuf_index; i++)
      if (strcmp (argbuf[i], "|") == 0)
        {				/* each command.  */
***************
*** 1657,1662 ****
--- 1731,1739 ----
  	  commands[n_commands].argv[0] = string;
  	n_commands++;
        }
+ #else
+   n_commands = 1;
+ #endif
  
    argbuf[argbuf_index] = 0;
  
***************
*** 1672,1680 ****
--- 1749,1759 ----
  	  for (j = commands[i].argv; *j; j++)
  	    fprintf (stderr, " %s", *j);
  
+ #ifndef atarist
  	  /* Print a pipe symbol after all but the last command.  */
  	  if (i + 1 != n_commands)
  	    fprintf (stderr, " |");
+ #endif
  	  fprintf (stderr, "\n");
  	}
        fflush (stderr);
***************
*** 1689,1699 ****
--- 1768,1780 ----
  #endif /* DEBUG */
      }
  
+ #ifndef atarist
    /* Run each piped subprocess.  */
  
    last_pipe_input = STDIN_FILE_NO;
    for (i = 0; i < n_commands; i++)
      {
+ #ifndef atariminix
        char *string = commands[i].argv[0];
  
        commands[i].pid = pexecute (string != commands[i].prog,
***************
*** 1700,1705 ****
--- 1781,1794 ----
  				  string, commands[i].argv,
  				  i + 1 < n_commands);
  
+ #else
+       extern int execv();
+       char *string = commands[i].argv[0];
+ 
+       commands[i].pid = pexecute (execv,
+ 				  string, commands[i].argv,
+ 				  i + 1 < n_commands);
+ #endif
        if (string != commands[i].prog)
  	free (string);
      }
***************
*** 1746,1751 ****
--- 1835,1885 ----
        }
      return ret_code;
    }
+ #else /* atarist */
+  {
+      register int iii;
+      int errfd, oldfd;
+      char **j;
+ 
+      execution_count++;
+ 
+      if (zflag)
+        {
+ 	 errfd = Fopen("compile.err", 2);
+ 	 if (errfd < __SMALLEST_VALID_HANDLE)
+ 	   errfd = Fcreate("compile.err", 0);
+ 	 else
+ 	   Fseek(0L, errfd, 2);
+ 	 if (errfd >= __SMALLEST_VALID_HANDLE)
+ 	   {
+ 	     oldfd = Fdup (2);
+ 	     Fforce(2, errfd);
+ 	   }
+ 	 else
+ 	   {
+ 	     error("cannot open %s", "compile.err");
+ 	     zflag = 0;		/* no redirection */
+ 	   }
+        }
+      for (i = 0; i < n_commands ; i++)
+      {
+          j = commands[i].argv;
+          iii = spawnve(0, j[0], j, NULL);
+ 	 if(iii != 0)
+ 	     break;
+      }
+      if (zflag)
+        {
+ 	 Fforce(2, oldfd);
+ 	 Fclose(oldfd);
+ 	 Fclose(errfd);
+        }
+      if (iii != 0)
+        return -1;
+      else
+        return 0;
+  }
+ #endif /* atarist */  
  }
  
  /* Find all the switches given to us
***************
*** 1809,1814 ****
--- 1943,1949 ----
  
    /* Set up the default search paths.  */
  
+ #ifndef CROSSATARI
    if (gcc_exec_prefix)
      {
        add_prefix (&exec_prefix, gcc_exec_prefix, 0, 0, NULL_PTR);
***************
*** 1885,1890 ****
--- 2020,2026 ----
  	    endp++;
  	}
      }
+ #endif /* CROSSATARI */
  
    /* Use LPATH like LIBRARY_PATH (for the CMU build program).  */
    temp = getenv ("LPATH");
***************
*** 2092,2097 ****
--- 2228,2239 ----
  		  n_switches++;
  		  break;
  		}
+ #ifdef atarist
+ 	    case 'z':	/* redirect stderr to a file */
+ 	      zflag++;
+ 	      n_switches++;
+ 	      break;
+ #endif
  	    default:
  	      n_switches++;
  
***************
*** 2111,2121 ****
--- 2253,2274 ----
       (such as cpp) rather than those of the host system.  */
    /* Use 2 as fourth arg meaning try just the machine as a suffix,
       as well as trying the machine and the version.  */
+ #if (defined(atarist) || defined(CROSSATARI) || defined(WEIRD))
+ /* NB defined(WEIRD) should not really be there, its only for my weird setup */
+   /* We are not using machine_suffix here, so do not make */
+   /* these prefixes available only when we have one       */
+   add_prefix (&exec_prefix, standard_exec_prefix, 0, 0, NULL_PTR);
+   add_prefix (&exec_prefix, standard_exec_prefix_1, 0, 0, NULL_PTR);
+ 
+   add_prefix (&startfile_prefix, standard_exec_prefix, 0, 0, NULL_PTR);
+   add_prefix (&startfile_prefix, standard_exec_prefix_1, 0, 0, NULL_PTR);
+ #else
    add_prefix (&exec_prefix, standard_exec_prefix, 0, 2, NULL_PTR);
    add_prefix (&exec_prefix, standard_exec_prefix_1, 0, 2, NULL_PTR);
  
    add_prefix (&startfile_prefix, standard_exec_prefix, 0, 1, NULL_PTR);
    add_prefix (&startfile_prefix, standard_exec_prefix_1, 0, 1, NULL_PTR);
+ #endif /* (defined(atarist) || defined(CROSSATARI)) */
  
    /* More prefixes are enabled in main, after we read the specs file
       and determine whether this is cross-compilation or not.  */
***************
*** 2283,2288 ****
--- 2436,2450 ----
     search dirs for it.  */
  static int this_is_library_file;
  
+ #ifdef atarist
+ /* I don't know why this is necessary.  Recursive calls to do_spec_1
+    end up ignoring the error code from calls to execute().  That causes
+    do_spec to get a 0 return value, and do_spec_1("\n"), which causes the
+    command to get executed again.
+ */
+ int execute_return_error = 0;
+ #endif
+ 
  /* Process the spec SPEC and run the commands specified therein.
     Returns 0 if the spec is successfully processed; -1 if failed.  */
  
***************
*** 2302,2311 ****
--- 2464,2482 ----
  
    /* Force out any unfinished command.
       If -pipe, this forces out the last command if it ended in `|'.  */
+ #ifdef atarist
+   if (!value && execute_return_error)
+ 	{
+ 	value = execute_return_error;
+ 	execute_return_error = 0;
+ 	}
+ #endif
    if (value == 0)
      {
+ #ifndef atarist
        if (argbuf_index > 0 && !strcmp (argbuf[argbuf_index - 1], "|"))
  	argbuf_index--;
+ #endif
  
        if (argbuf_index > 0)
  	value = execute ();
***************
*** 2342,2347 ****
--- 2513,2569 ----
         Otherwise, NL, SPC, TAB and % are special.  */
      switch (inswitch ? 'a' : c)
        {
+ #if (defined(atarist) || defined(CROSSATARI))
+ /* this stuff added by jrd.  if see '$', expect name of env var, delimited
+    by '$'.  Find it's value, and subst it in.
+ 
+    modified by ERS to only collect things that look like names; this
+    saves e.g. the -$ arg. to cpp from getting munged */
+ 
+       case '$':
+       {
+ 	char varname[32];		/* should be enough */
+ 	char * value;			/* deciphered value string */
+ 	char *temp;
+ 	int i;
+ 	extern char *getenv(), *index();
+ 	
+ 	for (i = 0 ; ((c = *p) != '$') && isalnum(c) && i < 31 ; i++, p++)
+ 		varname[i] = c;
+ 	varname[i] = '\0';
+ 	if (strlen(varname) > 0) /* ++jrb fix */
+ 	{
+              	++p;    /* skip trailing '$' */
+ 		value = getenv(varname); /* ++jrb fix */
+ 		if (value)
+ 		{ /* if value is a path, only consider 1'st component */
+ #ifdef atarist
+ 			if((temp = index(value, ',')) == NULL)
+ 			    temp = index(value, ';');
+ #else
+ 			temp = index(value, ':');
+ #endif
+ 			if(temp != NULL)
+ 			{
+ 			    char *t = (char *) alloca(strlen(value) + 1);
+ 			    strcpy(t, value);
+ 			    t[temp-value] = '\0';
+ 			    do_spec_1(t, 0);
+ 			}
+ 			else
+ 			    do_spec_1(value, 0);
+ 		}
+ 		    else
+ 			do_spec_1(".", 0);	/* a compleat kludge... */
+ 	}
+         else
+         {
+              obstack_1grow(&obstack, '$');
+              arg_going = 1;
+         }
+       }
+      break;
+ #endif /* atarist */
        case '\n':
  	/* End of line: finish any pending argument,
  	   then run the pending command if one has been started.  */
***************
*** 2379,2384 ****
--- 2601,2610 ----
  	if (argbuf_index > 0)
  	  {
  	    int value = execute ();
+ #ifdef atarist
+ 		if (!execute_return_error)
+ 			execute_return_error = value;
+ #endif
  	    if (value)
  	      return value;
  	  }
***************
*** 2923,2935 ****
--- 3149,3169 ----
  	    break;
  
  	  default:
+ #if 1 /* atarist */
+ 	    fprintf(stderr, "Bogus char '%c' found at pos %d of spec '%s'\n",
+ 		c, (p - spec - 1), spec);
+ #endif
  	    abort ();
  	  }
  	break;
  
+ #ifndef atarist
+       /* on the atari it is important to preserve backslash in spec */
+       /* so just let it go into default case */
        case '\\':
  	/* Backslash: treat next character as ordinary.  */
  	c = *p++;
+ #endif
  
  	/* fall through */
        default:
***************
*** 3197,3202 ****
--- 3431,3437 ----
  
  /* On fatal signals, delete all the temporary files.  */
  
+ #ifndef atarist
  static void
  fatal_error (signum)
       int signum;
***************
*** 3208,3213 ****
--- 3443,3449 ----
       so its normal effect occurs.  */
    kill (getpid (), signum);
  }
+ #endif
  
  int
  main (argc, argv)
***************
*** 3222,3227 ****
--- 3458,3468 ----
    char *explicit_link_files;
    char *specs_file;
  
+ #ifdef atarist
+ /* turn this on if you are going to set the TOS 1.4 dont clear heap flag */
+ /*  _malloczero(1); */ 	/* zero mallocs by default */
+   programname = "gcc";
+ #else  
    programname = argv[0];
  
    if (signal (SIGINT, SIG_IGN) != SIG_IGN)
***************
*** 3234,3239 ****
--- 3475,3481 ----
    if (signal (SIGPIPE, SIG_IGN) != SIG_IGN)
      signal (SIGPIPE, fatal_error);
  #endif
+ #endif /* atarist */
  
    argbuf_length = 10;
    argbuf = (char **) xmalloc (argbuf_length * sizeof (char *));
***************
*** 3240,3245 ****
--- 3482,3488 ----
  
    obstack_init (&obstack);
  
+ #if (!(defined(atarist) || defined(CROSSATARI)))
    /* Set up to remember the pathname of gcc and any options
       needed for collect.  */
    obstack_init (&collect_obstack);
***************
*** 3246,3251 ****
--- 3489,3495 ----
    obstack_grow (&collect_obstack, "COLLECT_GCC=", sizeof ("COLLECT_GCC=")-1);
    obstack_grow (&collect_obstack, programname, strlen (programname)+1);
    putenv (obstack_finish (&collect_obstack));
+ #endif
  
    /* Choose directory for temp files.  */
  
***************
*** 3257,3262 ****
--- 3501,3515 ----
  
    process_command (argc, argv);
  
+ #if (defined(atarist) || defined(CROSSATARI))
+   {
+     char *temp;
+     
+     if((temp = getenv ("GCCEXEC")))
+ 	add_prefix (&exec_prefix, temp, 0, 0, 0);
+   }
+ #endif
+   
    /* Initialize the vector of specs to just the default.
       This means one element containing 0s, as a terminator.  */
  
***************
*** 3264,3269 ****
--- 3517,3526 ----
    bcopy (default_compilers, compilers, sizeof default_compilers);
    n_compilers = n_default_compilers;
  
+ 
+ #if (defined(atarist) || defined(CROSSATARI) || defined(atariminix))
+   specs_file = 0;
+ #else
    /* Read specs from a file if there is one.  */
  
    machine_suffix = concat (spec_machine, "/", concat (spec_version, "/", ""));
***************
*** 3273,3278 ****
--- 3530,3536 ----
    /* Read the specs file unless it is a default one.  */
    if (specs_file != 0 && strcmp (specs_file, "specs"))
      read_specs (specs_file);
+ #endif
  
    /* If not cross-compiling, look for startfiles in the standard places.  */
    /* The fact that these are done here, after reading the specs file,
***************
*** 3325,3331 ****
--- 3583,3595 ----
  
    if (verbose_flag)
      {
+ #if (defined(atarist) || defined(CROSSATARI) || defined(atariminix))
+ #include "PatchLev.h"
+       fprintf (stderr, "gcc-atariST version %s Patchlevel %s\n",
+ 	       version_string, PatchLevel);
+ #else
        fprintf (stderr, "gcc version %s\n", version_string);
+ #endif
        if (n_infiles == 0)
  	exit (0);
      }
***************
*** 3373,3379 ****
--- 3637,3648 ----
  
  	  input_basename = input_filename;
  	  for (p = input_filename; *p; p++)
+ #ifdef atarist
+ 		if (((*p == '/') || (*p == '\\')) && (*(p-1) != ':'))
+ 		    /* allow both '\' and '/' with  our new lib */
+ #else
  	    if (*p == '/')
+ #endif
  	      input_basename = p + 1;
  
  	  /* Find a suffix starting with the last period,
***************
*** 3436,3441 ****
--- 3705,3711 ----
        int i;
        int first_time;
  
+ #if (!(defined(atarist) || defined(CROSSATARI)))
        /* Rebuild the COMPILER_PATH and LIBRARY_PATH environment variables
  	 for collect.  */
        putenv_from_prefixes (&exec_prefix, "COMPILER_PATH=");
***************
*** 3466,3471 ****
--- 3736,3742 ----
  	}
        obstack_grow (&collect_obstack, "\0", 1);
        putenv (obstack_finish (&collect_obstack));
+ #endif
  
        value = do_spec (link_command_spec);
        if (value < 0)
*** 1.6	1992/11/07 04:57:45
--- getpwd.c	1992/11/08 00:49:15
***************
*** 14,20 ****
     BSD systems) now provides getcwd as called for by POSIX.  Allow for
     the few exceptions to the general rule here.  */
  
! #if !(defined (POSIX) || defined (USG) || defined (VMS))
  #include <sys/param.h>
  extern char *getwd ();
  #define getcwd(buf,len) getwd(buf)
--- 14,20 ----
     BSD systems) now provides getcwd as called for by POSIX.  Allow for
     the few exceptions to the general rule here.  */
  
! #if !(defined (POSIX) || defined (USG) || defined (VMS) || defined(atarist) || defined(CROSSHPUX))
  #include <sys/param.h>
  extern char *getwd ();
  #define getcwd(buf,len) getwd(buf)
***************
*** 48,58 ****
    if (!p && !(errno = failure_errno))
      {
        if (! ((p = getenv ("PWD")) != 0
  	     && *p == '/'
  	     && stat (p, &pwdstat) == 0
  	     && stat (".", &dotstat) == 0
  	     && dotstat.st_ino == pwdstat.st_ino
! 	     && dotstat.st_dev == pwdstat.st_dev))
  
  	/* The shortcut didn't work.  Try the slow, ``sure'' way.  */
  	for (s = GUESSPATHLEN;  ! getcwd (p = xmalloc (s), s);  s *= 2)
--- 48,61 ----
    if (!p && !(errno = failure_errno))
      {
        if (! ((p = getenv ("PWD")) != 0
+ #ifndef atarist
  	     && *p == '/'
  	     && stat (p, &pwdstat) == 0
  	     && stat (".", &dotstat) == 0
  	     && dotstat.st_ino == pwdstat.st_ino
! 	     && dotstat.st_dev == pwdstat.st_dev
! #endif
! 	     ))
  
  	/* The shortcut didn't work.  Try the slow, ``sure'' way.  */
  	for (s = GUESSPATHLEN;  ! getcwd (p = xmalloc (s), s);  s *= 2)
*** 1.13	1992/11/07 04:57:45
--- toplev.c	1992/11/08 00:50:00
***************
*** 31,37 ****
  
  #include <sys/stat.h>
  
! #ifdef USG
  #undef FLOAT
  #include <sys/param.h>
  /* This is for hpux.  It is a real screw.  They should change hpux.  */
--- 31,37 ----
  
  #include <sys/stat.h>
  
! #if defined(USG) || defined(CROSSHPUX)
  #undef FLOAT
  #include <sys/param.h>
  /* This is for hpux.  It is a real screw.  They should change hpux.  */
***************
*** 41,49 ****
--- 41,57 ----
  #undef FFS  /* Some systems define this in param.h.  */
  #else
  #ifndef VMS
+ #if (!(defined(atarist) || defined(atariminix)))
  #include <sys/time.h>
  #include <sys/resource.h>
+ #endif /* !(atarist || atariminix) */
+ #endif
  #endif
+ 
+ #ifdef atariminix
+ #include <sys/times.h>
+ /* #include <minix/const.h>, avoid dragging this in */
+ #define HZ 60	/* this is the only thing needed from minix/const.h */
  #endif
  
  #include "input.h"
***************
*** 57,62 ****
--- 65,75 ----
  #include "xcoffout.h"
  #endif
  
+ #ifdef atarist
+ long _stksize = -1L;	/* for all sizes of ST's */
+ 	/* -1 means malloc from own heap and keep all  of memory */
+ #endif /* atarist */
+ 
  #ifdef VMS
  /* The extra parameters substantially improve the I/O performance.  */
  static FILE *
***************
*** 739,745 ****
  int
  get_run_time ()
  {
! #ifdef USG
    struct tms tms;
  #else
  #ifndef VMS
--- 752,761 ----
  int
  get_run_time ()
  {
! #ifdef atarist
!   long now;
! #else
! #if (defined(USG) || defined(atariminix) || defined(CROSSHPUX))
    struct tms tms;
  #else
  #ifndef VMS
***************
*** 754,764 ****
      } vms_times;
  #endif
  #endif
  
    if (quiet_flag)
      return 0;
  
! #ifdef USG
    times (&tms);
    return (tms.tms_utime + tms.tms_stime) * (1000000 / HZ);
  #else
--- 770,784 ----
      } vms_times;
  #endif
  #endif
+ #endif
  
    if (quiet_flag)
      return 0;
  
! #ifdef atarist
!   return(time(NULL) * 1000000);
! #else
! #if (defined(USG) || defined(atariminix) || defined(CROSSHPUX))
    times (&tms);
    return (tms.tms_utime + tms.tms_stime) * (1000000 / HZ);
  #else
***************
*** 771,776 ****
--- 791,797 ----
    return (vms_times.proc_user_time + vms_times.proc_system_time) * 10000;
  #endif
  #endif
+ #endif
  }
  
  #define TIMEVAR(VAR, BODY)    \
***************
*** 1407,1412 ****
--- 1428,1434 ----
    longjmp (float_handler, 1);
  }
  
+ #ifndef atarist
  /* Handler for SIGPIPE.  */
  
  static void
***************
*** 1416,1421 ****
--- 1438,1444 ----
  {
    fatal ("output pipe has been closed");
  }
+ #endif
  
  /* Strip off a legitimate source ending from the input string NAME of
     length LEN. */
***************
*** 1447,1452 ****
--- 1470,1476 ----
      name[len - 4] = 0;
  }
  
+ #ifdef SYSV
  /* Output a file name in the form wanted by System V.  */
  
  void
***************
*** 1475,1480 ****
--- 1499,1505 ----
  #endif
  #endif
  }
+ #endif
  
  /* Compile an entire file of output from cpp, named NAME.
     Write a file of assembly output and various debugging dumps.  */
***************
*** 1574,1580 ****
--- 1599,1609 ----
      {
        register char *dumpname = (char *) xmalloc (dump_base_name_length + 6);
        strcpy (dumpname, dump_base_name);
+ #ifndef atarist
        strcat (dumpname, ".jump");
+ #else
+       strcat (dumpname, ".jmp");
+ #endif
        jump_opt_dump_file = fopen (dumpname, "w");
        if (jump_opt_dump_file == 0)
  	pfatal_with_name (dumpname);
***************
*** 1596,1602 ****
--- 1625,1635 ----
      {
        register char *dumpname = (char *) xmalloc (dump_base_name_length + 6);
        strcpy (dumpname, dump_base_name);
+ #ifndef atarist
        strcat (dumpname, ".loop");
+ #else
+       strcat (dumpname, ".lop");
+ #endif
        loop_dump_file = fopen (dumpname, "w");
        if (loop_dump_file == 0)
  	pfatal_with_name (dumpname);
***************
*** 1607,1613 ****
--- 1640,1650 ----
      {
        register char *dumpname = (char *) xmalloc (dump_base_name_length + 6);
        strcpy (dumpname, dump_base_name);
+ #ifndef atarist
        strcat (dumpname, ".cse2");
+ #else
+       strcat (dumpname, ".cs2");
+ #endif
        cse2_dump_file = fopen (dumpname, "w");
        if (cse2_dump_file == 0)
  	pfatal_with_name (dumpname);
***************
*** 1618,1624 ****
--- 1655,1665 ----
      {
        register char *dumpname = (char *) xmalloc (dump_base_name_length + 6);
        strcpy (dumpname, dump_base_name);
+ #ifndef atarist
        strcat (dumpname, ".flow");
+ #else
+       strcat (dumpname, ".flo");
+ #endif
        flow_dump_file = fopen (dumpname, "w");
        if (flow_dump_file == 0)
  	pfatal_with_name (dumpname);
***************
*** 1629,1635 ****
--- 1670,1680 ----
      {
        register char *dumpname = (char *) xmalloc (dump_base_name_length + 10);
        strcpy (dumpname, dump_base_name);
+ #ifndef atarist
        strcat (dumpname, ".combine");
+ #else
+       strcat (dumpname, ".cmb");
+ #endif
        combine_dump_file = fopen (dumpname, "w");
        if (combine_dump_file == 0)
  	pfatal_with_name (dumpname);
***************
*** 1640,1646 ****
--- 1685,1695 ----
      {
        register char *dumpname = (char *) xmalloc (dump_base_name_length + 7);
        strcpy (dumpname, dump_base_name);
+ #ifndef atarist
        strcat (dumpname, ".sched");
+ #else
+       strcat (dumpname, ".sch");
+ #endif
        sched_dump_file = fopen (dumpname, "w");
        if (sched_dump_file == 0)
  	pfatal_with_name (dumpname);
***************
*** 1651,1657 ****
--- 1700,1710 ----
      {
        register char *dumpname = (char *) xmalloc (dump_base_name_length + 6);
        strcpy (dumpname, dump_base_name);
+ #ifndef atarist
        strcat (dumpname, ".lreg");
+ #else
+       strcat (dumpname, ".lrg");
+ #endif
        local_reg_dump_file = fopen (dumpname, "w");
        if (local_reg_dump_file == 0)
  	pfatal_with_name (dumpname);
***************
*** 1662,1668 ****
--- 1715,1725 ----
      {
        register char *dumpname = (char *) xmalloc (dump_base_name_length + 6);
        strcpy (dumpname, dump_base_name);
+ #ifndef atarist
        strcat (dumpname, ".greg");
+ #else
+       strcat (dumpname, ".grg");
+ #endif
        global_reg_dump_file = fopen (dumpname, "w");
        if (global_reg_dump_file == 0)
  	pfatal_with_name (dumpname);
***************
*** 1673,1679 ****
--- 1730,1740 ----
      {
        register char *dumpname = (char *) xmalloc (dump_base_name_length + 8);
        strcpy (dumpname, dump_base_name);
+ #ifndef atarist
        strcat (dumpname, ".sched2");
+ #else
+       strcat (dumpname, ".sc2");
+ #endif
        sched2_dump_file = fopen (dumpname, "w");
        if (sched2_dump_file == 0)
  	pfatal_with_name (dumpname);
***************
*** 1684,1690 ****
--- 1745,1755 ----
      {
        register char *dumpname = (char *) xmalloc (dump_base_name_length + 7);
        strcpy (dumpname, dump_base_name);
+ #ifndef atarist
        strcat (dumpname, ".jump2");
+ #else
+       strcat (dumpname, ".jp2");
+ #endif
        jump2_opt_dump_file = fopen (dumpname, "w");
        if (jump2_opt_dump_file == 0)
  	pfatal_with_name (dumpname);
***************
*** 1708,1714 ****
--- 1773,1783 ----
      {
        register char *dumpname = (char *) xmalloc (dump_base_name_length + 10);
        strcpy (dumpname, dump_base_name);
+ #ifndef atarist
        strcat (dumpname, ".stack");
+ #else
+       strcat (dumpname, ".stk");
+ #endif
        stack_reg_dump_file = fopen (dumpname, "w");
        if (stack_reg_dump_file == 0)
  	pfatal_with_name (dumpname);
***************
*** 2749,2760 ****
--- 2818,2839 ----
    int version_flag = 0;
    char *p;
  
+ #ifdef atarist
+ /* turn this on if you are going to set the TOS 1.4 dont clear heap flag */
+ /*  _malloczero(1); */ 	/* zero mallocs by default */
+ #endif  
+ 
    /* save in case md file wants to emit args as a comment.  */
    save_argc = argc;
    save_argv = argv;
  
    p = argv[0] + strlen (argv[0]);
+ #ifndef atarist
    while (p != argv[0] && p[-1] != '/') --p;
+ #else
+   while (p != argv[0] && ((p[-1] != '/') && (p[-1] != '\\') &&
+ 			  (p[-1] != ':'))) --p;
+ #endif
    progname = p;
  
  #ifdef RLIMIT_STACK
***************
*** 2771,2777 ****
--- 2850,2858 ----
  
    signal (SIGFPE, float_signal);
  
+ #ifndef atarist
    signal (SIGPIPE, pipe_closed);
+ #endif
  
    decl_printable_name = decl_name;
    lang_expand_expr = (struct rtx_def *(*)()) do_abort;
***************
*** 2869,2874 ****
--- 2950,2965 ----
  	  else if (!strcmp (str, "dumpbase"))
  	    {
  	      dump_base_name = argv[++i];
+ #ifdef atarist
+ /* dump_base_name will typically be 'foo.c' here.  Need to truncate at the '.',
+    cause dots mean something here */
+ 	    {
+ 	      char * n = dump_base_name;
+ 	      for ( ; ((*n) && (*n != '.')) ; )
+ 		n++;
+ 	      *n = '\0';
+ 	    }
+ #endif
  	    }
  	  else if (str[0] == 'd')
  	    {
***************
*** 3261,3267 ****
--- 3352,3364 ----
       option flags in use.  */
    if (version_flag)
      {
+ #if (defined(atarist) || defined(CROSSATARI) || defined(atariminix))
+ #include "PatchLev.h"
+ 	    fprintf (stderr, "%s version %s-atariST Patchlevel %s",
+ 		 language_string, version_string, PatchLevel);
+ #else
        fprintf (stderr, "%s version %s", language_string, version_string);
+ #endif
  #ifdef TARGET_VERSION
        TARGET_VERSION;
  #endif
***************
*** 3282,3287 ****
--- 3379,3386 ----
  
    compile_file (filename);
  
+ #if (!(defined(atarist) || defined(atariminix)))
+ #if (!(defined(CROSSHPUX)))
  #ifndef OS2
  #ifndef VMS
    if (flag_print_mem)
***************
*** 3300,3305 ****
--- 3399,3406 ----
      }
  #endif /* not VMS */
  #endif /* not OS2 */
+ #endif
+ #endif
  
    if (errorcount)
      exit (FATAL_EXIT_CODE);
***************
*** 3411,3413 ****
--- 3512,3545 ----
  
    fprintf (stderr, "\n");
  }
+ 
+ #ifdef atarist
+ void atari_output_filename(file, filename)
+ FILE *file;
+ char *filename;
+ {
+     if( (!file) || (!filename) ) return;
+     for(; *filename; filename++)
+     {
+ 	if(*filename == '\\') putc('\\', file);
+ 	putc(*filename, file);
+     }
+ }
+ 
+ #include <string.h>
+ 
+ char *atari_filename_nondirectory(p)
+ char *p;
+ {
+     char *s;
+     
+     for(s = p + strlen(p); s != p; --s)
+     {
+ 	if((*s == '/') || (*s == '\\'))
+ 	    break;
+     }
+     
+     return (s == p) ? p : s+1;
+ }
+ 
+ #endif
*** 1.5	1992/11/07 04:57:45
--- varasm.c	1992/11/08 00:50:05
***************
*** 978,991 ****
  assemble_external_libcall (fun)
       rtx fun;
  {
- #ifdef ASM_OUTPUT_EXTERNAL_LIBCALL
    /* Declare library function name external when first used, if nec.  */
    if (! SYMBOL_REF_USED (fun))
      {
        SYMBOL_REF_USED (fun) = 1;
        ASM_OUTPUT_EXTERNAL_LIBCALL (asm_out_file, fun);
-     }
  #endif
  }
  
  /* Declare the label NAME global.  */
--- 978,991 ----
  assemble_external_libcall (fun)
       rtx fun;
  {
    /* Declare library function name external when first used, if nec.  */
    if (! SYMBOL_REF_USED (fun))
      {
        SYMBOL_REF_USED (fun) = 1;
+ #ifdef ASM_OUTPUT_EXTERNAL_LIBCALL
        ASM_OUTPUT_EXTERNAL_LIBCALL (asm_out_file, fun);
  #endif
+     }
  }
  
  /* Declare the label NAME global.  */
*** 1.4	1992/11/07 05:03:40
--- m68k.c	1992/11/08 00:54:49
***************
*** 60,66 ****
     
  finalize_pic ()
  {
!   if (flag_pic && current_function_uses_pic_offset_table)
      emit_insn (gen_rtx (USE, VOIDmode, pic_offset_table_rtx));
  }
  
--- 60,66 ----
     
  finalize_pic ()
  {
!   if (flag_pic && (flag_pic < 3) && current_function_uses_pic_offset_table)
      emit_insn (gen_rtx (USE, VOIDmode, pic_offset_table_rtx));
  }
  
***************
*** 213,219 ****
        asm_fprintf (stream, "\tmoveml %0I0x%x,%Rsp@-\n", mask);
  #endif
      }
!   if (flag_pic && current_function_uses_pic_offset_table)
      {
  #ifdef MOTOROLA
        asm_fprintf (stream, "\t%Omove.l %0I__GLOBAL_OFFSET_TABLE_, %s\n",
--- 213,219 ----
        asm_fprintf (stream, "\tmoveml %0I0x%x,%Rsp@-\n", mask);
  #endif
      }
!   if (flag_pic && (flag_pic < 3) && current_function_uses_pic_offset_table)
      {
  #ifdef MOTOROLA
        asm_fprintf (stream, "\t%Omove.l %0I__GLOBAL_OFFSET_TABLE_, %s\n",
***************
*** 803,814 ****
    /* First handle a simple SYMBOL_REF or LABEL_REF */
    if (GET_CODE (orig) == SYMBOL_REF || GET_CODE (orig) == LABEL_REF)
      {
        if (reg == 0)
  	abort ();
  
!       pic_ref = gen_rtx (MEM, Pmode,
! 			 gen_rtx (PLUS, Pmode,
! 				  pic_offset_table_rtx, orig));
        current_function_uses_pic_offset_table = 1;
        RTX_UNCHANGING_P (pic_ref) = 1;
        emit_move_insn (reg, pic_ref);
--- 803,822 ----
    /* First handle a simple SYMBOL_REF or LABEL_REF */
    if (GET_CODE (orig) == SYMBOL_REF || GET_CODE (orig) == LABEL_REF)
      {
+ #ifdef LEGITIMATE_BASEREL_OPERAND_P
+   if (LEGITIMATE_BASEREL_OPERAND_P (orig))
+     return orig;
+ #endif
+ 
        if (reg == 0)
  	abort ();
  
!       if (flag_pic == 3)
!         pic_ref = gen_rtx (PLUS, Pmode, pic_offset_table_rtx, orig);
!       else
!         pic_ref = gen_rtx (MEM, Pmode,
! 			   gen_rtx (PLUS, Pmode,
! 				    pic_offset_table_rtx, orig));
        current_function_uses_pic_offset_table = 1;
        RTX_UNCHANGING_P (pic_ref) = 1;
        emit_move_insn (reg, pic_ref);
***************
*** 840,845 ****
--- 848,854 ----
        pic_ref = gen_rtx (PLUS, Pmode, base, orig);
        /* Likewise, should we set special REG_NOTEs here?  */
      }
+ 
    return pic_ref;
  }
  
***************
*** 1582,1587 ****
--- 1591,1599 ----
        output_address (XEXP (op, 0));
        if (letter == 'd' && ! TARGET_68020
  	  && CONSTANT_ADDRESS_P (XEXP (op, 0))
+ 	  && !(TARGET_PC_REL && GET_CODE (XEXP (op, 0)) == SYMBOL_REF
+ 	       && SYMBOL_REF_FLAG (XEXP (op, 0))
+ 	       && !SYMBOL_REF_USED (XEXP (op, 0)))
  	  && !(GET_CODE (XEXP (op, 0)) == CONST_INT
  	       && INTVAL (XEXP (op, 0)) < 0x8000
  	       && INTVAL (XEXP (op, 0)) >= -0x8000))
***************
*** 1887,1892 ****
--- 1899,1906 ----
  	          fprintf (file, ":w");
  	        if ((flag_pic == 2) && (breg == pic_offset_table_rtx))
  	          fprintf (file, ":l");
+ 	        if ((flag_pic == 3) && (breg == pic_offset_table_rtx))
+ 	          fprintf (file, ":W");
  	      }
  	    if (addr != 0 && ireg != 0)
  	      {
***************
*** 1964,1969 ****
--- 1978,1996 ----
  	    fprintf (file, "%d:w", INTVAL (addr));
  #endif
  	  }
+ 	else if (TARGET_PC_REL && GET_CODE (addr) == SYMBOL_REF
+ 		 && SYMBOL_REF_FLAG (addr)
+ 		 && !SYMBOL_REF_USED (addr))
+ 	  {
+ #ifdef MOTOROLA
+ 	    output_addr_const (file, addr);
+ 	    fputs ("(pc)", file);
+ #else
+ 	    fputs ("pc@(", file);
+ 	    output_addr_const (file, addr);
+ 	    putc (')', file);
+ #endif
+ 	  }
  	else
  	  {
  	    output_addr_const (file, addr);
***************
*** 1971,1973 ****
--- 1998,2015 ----
  	break;
      }
  }
+ #ifdef ENCODE_SECTION_INFO
+ /* Does operand (which is a symbolic_operand) live in text space? If
+    so SYMBOL_REF_FLAG, which is set by ENCODE_SECTION_INFO, will be true.*/
+ 
+ int
+ read_only_operand (operand)
+      rtx operand;
+ {
+   if (GET_CODE (operand) == CONST)
+     operand = XEXP (XEXP (operand, 0), 0);
+   if (GET_CODE (operand) == SYMBOL_REF)
+     return SYMBOL_REF_FLAG (operand) || CONSTANT_POOL_ADDRESS_P (operand);
+   return 1;
+ }
+ #endif
*** 1.6	1992/11/07 05:03:40
--- m68k.h	1992/11/08 00:54:49
***************
*** 92,97 ****
--- 92,103 ----
  /* Use the 68040-only fp instructions (-m68040).  */
  #define TARGET_68040_ONLY (target_flags & 01000)
  
+ /* Use PC-relative addressing for refs to read-only data */
+ #define TARGET_PC_REL (target_flags & 02000)
+ 
+ /* Use base-relative addressing for refs to data&bss segments */
+ #define TARGET_BASE_REL (target_flags & 04000)
+ 
  /* Macro to define tables used to set the flags.
     This is a list in braces of pairs in braces,
     each pair being { "NAME", VALUE }
***************
*** 119,124 ****
--- 125,134 ----
      { "68030", -01400},				\
      { "68030", 7},				\
      { "68040", 01007},			\
+     { "pcrel", 02000},				\
+     { "nopcrel", -02000},			\
+     { "baserel", 04000},			\
+     { "nobaserel", -04000},			\
      { "", TARGET_DEFAULT}}
  /* TARGET_DEFAULT is defined in sun*.h and isi.h, etc.  */
  
***************
*** 130,135 ****
--- 140,146 ----
    if (TARGET_FPA) target_flags &= ~2;	\
    if (! TARGET_68020 && flag_pic == 2)	\
      error("-fPIC is not currently supported on the 68000 or 68010\n");	\
+   if (TARGET_BASE_REL) flag_pic = 3;	\
  }
  #else
  #define OVERRIDE_OPTIONS		\
***************
*** 136,141 ****
--- 147,153 ----
  {					\
    if (! TARGET_68020 && flag_pic == 2)	\
      error("-fPIC is not currently supported on the 68000 or 68010\n");	\
+   if (TARGET_BASE_REL) flag_pic = 3;	\
  }
  #endif /* defined SUPPORT_SUN_FPA */
  
***************
*** 327,335 ****
  #ifndef SUPPORT_SUN_FPA
  
  #define CONDITIONAL_REGISTER_USAGE \
! {                                               \
!   if (flag_pic)                                 \
!     fixed_regs[PIC_OFFSET_TABLE_REGNUM] = 1;    \
  }
  
  #else /* defined SUPPORT_SUN_FPA */
--- 339,350 ----
  #ifndef SUPPORT_SUN_FPA
  
  #define CONDITIONAL_REGISTER_USAGE \
! {                                                \
!   if (flag_pic)                                  \
!     fixed_regs[PIC_OFFSET_TABLE_REGNUM] = 1;     \
!   /* prevent saving/restoring of the base reg */ \
!   if (flag_pic == 3)				 \
!     call_used_regs[PIC_OFFSET_TABLE_REGNUM] = 1; \
  }
  
  #else /* defined SUPPORT_SUN_FPA */
***************
*** 1111,1116 ****
--- 1126,1133 ----
         && REG_P (XEXP (X, 0)) && REG_OK_FOR_BASE_P (XEXP (X, 0))	\
         && GET_CODE (XEXP (X, 1)) == CONST_INT				\
         && ((unsigned) INTVAL (XEXP (X, 1)) + 0x8000) < 0x10000)		\
+    || (GET_CODE (X) == PLUS && XEXP (X, 0) == pic_offset_table_rtx 	\
+        && flag_pic == 3 && CONSTANT_ADDRESS_P (XEXP (X, 1)))		\
     || (GET_CODE (X) == PLUS && XEXP (X, 0) == pic_offset_table_rtx 	\
         && flag_pic && GET_CODE (XEXP (X, 1)) == SYMBOL_REF)		\
     || (GET_CODE (X) == PLUS && XEXP (X, 0) == pic_offset_table_rtx 	\
*** 1.5	1992/11/07 05:03:40
--- m68k.md	1992/11/08 00:54:50
***************
*** 704,716 ****
  {
    if (flag_pic && symbolic_operand (operands[1], SImode)) 
      {
!       /* The source is an address which requires PIC relocation.  
!          Call legitimize_pic_address with the source, mode, and a relocation
!          register (a new pseudo, or the final destination if reload_in_progress
!          is set).   Then fall through normally */
!       extern rtx legitimize_pic_address();
!       rtx temp = reload_in_progress ? operands[0] : gen_reg_rtx (Pmode);
!       operands[1] = legitimize_pic_address (operands[1], SImode, temp);
      }
  }")
  
--- 704,721 ----
  {
    if (flag_pic && symbolic_operand (operands[1], SImode)) 
      {
! #ifdef LEGITIMATE_BASEREL_OPERAND_P
!       if (flag_pic != 3 || !LEGITIMATE_BASEREL_OPERAND_P (operands[1]))
! #endif
!       {
!         /* The source is an address which requires PIC relocation.  
!            Call legitimize_pic_address with the source, mode, and a relocation
!            register (a new pseudo, or the final destination if reload_in_progress
!            is set).   Then fall through normally */
!         extern rtx legitimize_pic_address();
!         rtx temp = reload_in_progress ? operands[0] : gen_reg_rtx (Pmode);
!         operands[1] = legitimize_pic_address (operands[1], SImode, temp);
!       }
      }
  }")
  
***************
*** 4651,4657 ****
    ""
    "
  {
!   if (flag_pic && GET_CODE (XEXP (operands[0], 0)) == SYMBOL_REF)
      operands[0] = gen_rtx (MEM, GET_MODE (operands[0]),
  			   force_reg (Pmode, XEXP (operands[0], 0)));
  }")
--- 4656,4662 ----
    ""
    "
  {
!   if (flag_pic && flag_pic < 3 && GET_CODE (XEXP (operands[0], 0)) == SYMBOL_REF)
      operands[0] = gen_rtx (MEM, GET_MODE (operands[0]),
  			   force_reg (Pmode, XEXP (operands[0], 0)));
  }")
***************
*** 4662,4668 ****
  	 (match_operand:SI 1 "general_operand" "g"))]
    ;; Operand 1 not really used on the m68000.
  
!   "! flag_pic"
    "*
  #ifdef MOTOROLA
    return \"jsr %0\";
--- 4667,4673 ----
  	 (match_operand:SI 1 "general_operand" "g"))]
    ;; Operand 1 not really used on the m68000.
  
!   "(! flag_pic || flag_pic == 3)"
    "*
  #ifdef MOTOROLA
    return \"jsr %0\";
***************
*** 4677,4683 ****
  	 (match_operand:SI 1 "general_operand" "g"))]
    ;; Operand 1 not really used on the m68000.
  
!   "flag_pic"
    "*
    return \"jsr %0\";
  ")
--- 4682,4688 ----
  	 (match_operand:SI 1 "general_operand" "g"))]
    ;; Operand 1 not really used on the m68000.
  
!   "(flag_pic && flag_pic < 3)"
    "*
    return \"jsr %0\";
  ")
***************
*** 4693,4699 ****
    ""
    "
  {
!   if (flag_pic && GET_CODE (XEXP (operands[1], 0)) == SYMBOL_REF)
      operands[1] = gen_rtx (MEM, GET_MODE (operands[1]),
  			   force_reg (Pmode, XEXP (operands[1], 0)));
  }")
--- 4698,4704 ----
    ""
    "
  {
!   if (flag_pic && flag_pic < 3 && GET_CODE (XEXP (operands[1], 0)) == SYMBOL_REF)
      operands[1] = gen_rtx (MEM, GET_MODE (operands[1]),
  			   force_reg (Pmode, XEXP (operands[1], 0)));
  }")
***************
*** 4704,4710 ****
  	(call (match_operand:QI 1 "memory_operand" "o")
  	      (match_operand:SI 2 "general_operand" "g")))]
    ;; Operand 2 not really used on the m68000.
!   "! flag_pic"
    "*
  #ifdef MOTOROLA
    return \"jsr %1\";
--- 4709,4715 ----
  	(call (match_operand:QI 1 "memory_operand" "o")
  	      (match_operand:SI 2 "general_operand" "g")))]
    ;; Operand 2 not really used on the m68000.
!   "(! flag_pic || flag_pic == 3)"
    "*
  #ifdef MOTOROLA
    return \"jsr %1\";
***************
*** 4719,4725 ****
  	(call (match_operand:QI 1 "memory_operand" "o")
  	      (match_operand:SI 2 "general_operand" "g")))]
    ;; Operand 2 not really used on the m68000.
!   "flag_pic"
    "*
    return \"jsr %1\";
  ")
--- 4724,4730 ----
  	(call (match_operand:QI 1 "memory_operand" "o")
  	      (match_operand:SI 2 "general_operand" "g")))]
    ;; Operand 2 not really used on the m68000.
!   "(flag_pic && flag_pic < 3)"
    "*
    return \"jsr %1\";
  ")
